package com.kyzh.core.uis

import android.content.Context
import android.util.AttributeSet
import android.view.GestureDetector
import android.view.GestureDetector.SimpleOnGestureListener
import android.view.MotionEvent
import com.kyzh.core.R
import com.shuyu.gsyvideoplayer.video.NormalGSYVideoPlayer


class VideoView : NormalGSYVideoPlayer {

    constructor(context: Context, fullFlag: Boolean):super(context, fullFlag)
    constructor(context: Context):super(context)
    constructor(context: Context, attrs: AttributeSet):super(context, attrs)
    init {
        post {
            gestureDetector = GestureDetector(context.applicationContext, object : SimpleOnGestureListener() {
                override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
                    if (gsyVideoManager.isPlaying) {
                        onVideoPause()
                    } else {
                        onVideoResume(false)
                    }
                    return true
                }
            })
        }
    }

    override fun getLayoutId(): Int {
        return R.layout.view_video
    }

}
